package com.yjh.admin.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 填充一些固定的属性，只要给属性加上@TableField(fill = FieldFill.UPDATE)，就会自动填充
 * @author lbc
 */
@Component
public class DataFillHandler implements MetaObjectHandler {


    @Override
    public void insertFill(MetaObject metaObject) {

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
    }
}

